//
//  BNDChooseCompanyHelper.m
//  OfficeDoc
//
//  Created by pie on 2022/4/1.
//  Copyright © 2022 pie. All rights reserved.
//

#import "BNDChooseCompanyHelper.h"
#import "BNDChooseCompanyCell.h"

@interface BNDChooseCompanyHelper()<UITableViewDelegate,UITableViewDataSource,TableViewHelperDelegate>

@end

@implementation BNDChooseCompanyHelper

- (instancetype)initWith:(UITableView *)tableView
{
    if((self = [super initWith:tableView]) != nil) {
        self.tableView.delegate = self;
        self.tableView.dataSource = self;
        self.delegate = self;
    }
    return self;
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.datas.count;
}

- (BNDChooseCompanyCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    static NSString *Identifier = @"BNDChooseCompanyCell";
    BNDChooseCompanyCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier];
    if (!cell) {
        cell = [[BNDChooseCompanyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:Identifier];
    }

    cell.model = self.datas[indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    BND_BLOCK_EXEC(self.block,self.datas[indexPath.row]);
}

- (CGFloat)tableView:(nonnull UITableView *)tableView heightForRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{
    return 64;
}

#pragma mark -网络数据请求入口

- (void)load:(int)page tableView:(UITableView *)tableView
{
    BNDChooseCompanyModel *mode1 = [BNDChooseCompanyModel new];
    mode1.companyName = @"安徽众聘网络科技有限公司1";
    mode1.isSelected = YES;
    
    BNDChooseCompanyModel *mode2 = [BNDChooseCompanyModel new];
    mode2.companyName = @"安徽众聘网络科技有限公司2";
    
    BNDChooseCompanyModel *mode3 = [BNDChooseCompanyModel new];
    mode3.companyName = @"安徽众聘网络科技有限公司3";
    
    BNDChooseCompanyModel *mode9 = [BNDChooseCompanyModel new];
    mode9.companyName = @"安徽众聘网络科技有限公司4";
    
    BNDChooseCompanyModel *mode4 = [BNDChooseCompanyModel new];
    mode4.companyName = @"安徽众聘网络科技有限公司5";
    
    BNDChooseCompanyModel *mode5 = [BNDChooseCompanyModel new];
    
    mode5.companyName = @"安徽众聘网络科技有限公司6";
    BNDChooseCompanyModel *mode10 = [BNDChooseCompanyModel new];
    mode10.companyName = @"安徽众聘网络科技有限公司7";
    
    BNDChooseCompanyModel *mode6 = [BNDChooseCompanyModel new];
    mode6.companyName = @"安徽众聘网络科技有限公司8";
    
    BNDChooseCompanyModel *mode7 = [BNDChooseCompanyModel new];
    mode7.companyName = @"安徽众聘网络科技有限公司9";
    
    BNDChooseCompanyModel *mode8 = [BNDChooseCompanyModel new];
    mode8.companyName = @"安徽众聘网络科技有限公司10";
    [self finish:@[mode1,mode2,mode3,mode4,mode5,mode6,mode7,mode8,mode9,mode10] errcode:0 inView:self.tableView];
}

@end


@implementation BNDChooseCompanyModel

@end
